<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Keyword Cross Match - Vue.js Version</title>
    <!-- 引入Vue.js CDN -->
    <style>
        body {
            font-family: Arial, sans-serif;
        }

        .container {
            max-width: 1420px;
            margin: 0 auto;
            padding: 20px;
        }

        .container-con {
            display: flex;
            gap: 30px;
        }

        .input-group {
            margin-bottom: 10px;
            width: 33.33333%;
        }

        textarea {
            width: 100%;
            height: 100px;
            resize: vertical;
            padding: 10px;
            box-sizing: border-box;
            font-size: 16px;
        }

        button {
            display: block;
            margin: 20px auto;
            padding: 10px 20px;
            background-color: #007BFF;
            color: white;
            border: none;
            border-radius: 4px;
            font-size: 18px;
            cursor: pointer;
            transition: background-color 0.3s ease;
        }

        button:hover {
            background-color: #0056b3;
        }

        #results {
            margin-top: 20px;
            max-height: 400px;
            overflow-y: auto;
            border-top: 1px solid #ddd;
            padding-top: 20px;
        }

        #results p {
            font-size: 16px;
            margin: 5px 0;
        }
    </style>
</head>

<body>
    <div id="app" class="container">
        <div class="container-con">
            <div class="input-group">
                <label for="input1">Keyword Set 1:</label>
                <textarea id="input1" v-model="input1"></textarea>
            </div>
            <div class="input-group">
                <label for="input2">Keyword Set 2:</label>
                <textarea id="input2" v-model="input2"></textarea>
            </div>
            <div class="input-group">
                <label for="input3">Keyword Set 3:</label>
                <textarea id="input3" v-model="input3"></textarea>
            </div>
        </div>

        <button @click="generateTitles">Generate Titles</button>

        <div id="results">
            <p v-if="results.length === 0">No results generated yet.</p>
            <p v-for="(title, index) in results" :key="index">{{ title }}</p>
        </div>
    </div>
    <script src="/vue.min.js"></script>
    <script>
        new Vue({
            el: '#app',
            data: {
                input1: '',
                input2: '',
                input3: '',
                results: []
            },
            methods: {
                generateTitles() {
                    const startTime = performance.now();

                    const keywords1 = this.input1.split('\n').map(item => item.trim()).filter(item => item);
                    const keywords2 = this.input2.split('\n').map(item => item.trim()).filter(item => item);
                    const keywords3 = this.input3.split('\n').map(item => item.trim()).filter(item => item);

                    this.results = [];

                    if (keywords1.length === 0 || keywords2.length === 0 || keywords3.length === 0) {
                        alert('Please ensure all keyword sets have at least one keyword.');
                        return;
                    }

                    keywords1.forEach(kw1 => {
                        keywords2.forEach(kw2 => {
                            keywords3.forEach(kw3 => {
                                const title = `${kw1}${kw2}${kw3}`;
                                this.results.push(title);
                            });
                        });
                    });

                    const endTime = performance.now();
                    console.log(`Execution time: ${(endTime - startTime).toFixed(2)} ms`);
                }
            }
        });
    </script>
</body>

</html>